#include<stdio.h>

//https://www.nowcoder.com/practice/5b143af8328f4e42adf5e10397ae44ef?tpId=290&tags=&title=&difficulty=0&judgeStatus=0&rp=0&sourceUrl=%2Fexam%2Foj%2Fta%3FtpId%3D290

int main() {
    int num1 = 0;
    scanf("%d", &num1);
    for (int count = 1; count <= num1; count++) {
        int tmp = count;
        int num2 = 0;
        while (tmp) {
            num2 = num2 * 10 + tmp % 10;
            tmp /= 10;
        }
        if (count == num2) {
            printf("%d\n", count);
        }
    }
    return 0;
}